<template>
  <page-body>
    <view class="page">
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-start benben-flex-layout course_flex_0">
        <view class='flex flex-wrap align-end justify-between course_fd0_0'>
          <text class='fu-iconfont2  course_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="switchTab"
            :data-url="`/pagetabBar/about/about`">&#xe794;</text>
          <view class='flex flex-wrap align-center'>
            <text class='course_fd0_0_c1_c0'>课程中心</text>
          </view>
          <!-- <view></view> -->
          <text class='fu-iconfont2  course_fd0_0_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
            :data-url="`/pageguofang/honoDeta/search/search?are=1`">&#xe722;</text>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center course_flex_1">
          <benben-flex-tabs class-name='course_benbenTabsfd1_0' v-model="tabsLab" ref="benben_tabsfd1_0"
            select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false' :open-sticky='false' :top='0'
            :is-show-content='false' :scrollspy='false' :tabs-info.sync="tabsInfofd1_0"
            @change="getvb47eac5a55c0bFunc()" v-if=" tabsShow===true">
            <scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
              class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left="tabsInfofd1_0.moveX"
              scroll-with-animation="all .3s ease">
              <view class="benben-tabs-content" id="benben_tabsfd1_0-content">
                <view id="benben_tabsfd1_0-title" class="benben-tabs-title flex flex align-center justify-around" style="color: #fff;">
                  <template v-for='(item,key0) in tabs'>
                    <view :key='key0'
                      :class="{ 'checkTitlefd1_0': tabsLab == item.aid, 'flex flex-wrap align-center course_titlefd1_0_c3': true }"
                      @tap="tabsLab = item.aid" :id="`benben_tabsfd1_0-title-item-${item.aid}`">

                      <text class='course_titleItemfd1_0_c3_c0'>{{item.cate_name}}</text>

                    </view>
                  </template>
                </view>
                <view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
                  id="benben_tabsfd1_0-line" class="benben-tabs-line flex benben-flex-tabs-line course_linefd1_0">
                </view>
              </view>
            </scroll-view>

          </benben-flex-tabs>
      </view>
      <view style="width: 100%;height: 240rpx;z-index: 1;"></view>
      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
<!-- <scroll-view :scroll-y="true" :show-scrollbar='true' :refresher-enabled='true' @refresherrefresh="getAjax"
        :refresher-triggered="isShow"> -->
      <view class="flex flex-wrap align-center justify-between benben-flex-layout course_flex_2">
        <template v-for='(item,key0) in list'>
          <view class='flex flex-direction flex-wrap align-stretch course_fd2_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/honoDeta/courseIns/courseIns?course_id=${item.aid}&navType=1`" :key='key0'>
            <image class='course_fd2_0_c0' mode="aspectFill" :src='item.thumb'></image>
            <text class='course_fd2_0_c1' v-if=" item.is_study=='1'">{{item}}</text>
            <view class='flex flex-direction flex-wrap align-stretch course_fd2_0_c2'>
              <text class='course_fd2_0_c2_c0'>{{item.name}}</text>
              <view class='flex flex-wrap align-center course_fd2_0_c2_c1'>
                <text>共</text>
                <text>{{item.chapter_num}}</text>
                <text>章节</text>
              </view>
            </view>
          </view>
        </template>

      </view>
 <!-- </scroll-view> -->
      <!---flex布局flex布局结束-->


    </view>
  </page-body>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "tabsInfofd1_0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "tabs": [],
        "tabsLab": "",
        "tabsShow": false,
        "list": [],
        isShow: false,
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {
      this.getsk47eab99d93f6Func()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      uni.setStorageSync("are",1)
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getvb47eac5a55c0bFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      getAjax() {
        var that = this;
        if (!that.isShow) {
          that.isShow = true;
          //下拉加载，先让其变true再变false才能关闭
          //关闭加载状态 ，需要一点延时才能关闭
          // this.get_banner_listFunc()
          // this.getmk6bda39629cbfFunc()
          this.getvb47eac5a55c0bFunc()
          setTimeout(() => {
            that.isShow = false;
          }, 200)
        }
      },
      //查询课程分类
      async getsk47eab99d93f6Func() {
        //请求方法
        //数据验证

        let datatabs = await this.$api.get(global.apiUrls.post647eab99d93f6, {

        });

        if (datatabs.data.code != 1) {
          this.$message.info(datatabs.data.msg);
          return
        }
        let infotabs = datatabs.data;
        this.tabs = infotabs.data

        this.tabsLab = this.tabs[0].aid;
        this.tabsShow = true;
        this.getvb47eac5a55c0bFunc()
      },
      //查询课程列表
      async getvb47eac5a55c0bFunc() {
        //请求方法
        //数据验证

        let datalist = await this.$api.get(global.apiUrls.post647eac5a55c0b, {
          coursecate_id: this.tabsLab,
          type: '2'
        });

        if (datalist.data.code != 1) {
          this.$message.info(datalist.data.msg);
          return
        }
        let infolist = datalist.data;
        this.list = infolist.data

      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F6F6F6;
    background-size: 100% auto;

  }

  .course_flex_0 {
    background:#CC221C 0%;
    background-size: 100% auto;
    height: 164rpx;
    width: 100%;
    padding: 66rpx 32rpx 0rpx 32rpx;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 969999999900000000;
    margin: 0rpx 0rpx 0rpx 0rpx;
  }

  .course_fd0_0_c2 {
    font-size: 32rpx;
    color: var(--benbenFontColor3);
  }

  .course_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    line-height: 50rpx;
    color: var(--benbenFontColor3);
    margin: 0rpx 0rpx 0rpx 12rpx;
  }

  .course_fd0_0_c0 {
    font-size: 36rpx;
    color: var(--benbenFontColor3);
  }

  .course_fd0_0 {
    background: #CC221C ;
    width: 100%;
    margin: -71rpx 0rpx 0rpx -34rpx;
    height: 180rpx;
    position: fixed;
    padding: 24rpx;
    z-index: 9699999999;
    background-size: 100% auto;
  }

  .course_flex_1 {
    margin: 0rpx 0rpx 0rpx 0rpx;
    color: #fff;
    z-index: 10000000000;
    position: fixed;
    top: 160rpx;
    left: 0;

  }

  .course_titleItemfd1_0_c3_c0 {
    color: var(--benbenFontColor3);
  }

  .course_titlefd1_0_c3 {
    margin: 0rpx 30rpx 0rpx 30rpx;
  }

  .course_linefd1_0 {
    background: #fff;
    width: 30rpx;
    height: 8rpx;
    top: 80rpx;
    background-size: 100% auto !important;
    border-radius: 16rpx;
  }

  .checkTitlefd1_0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #FFFFFF !important;
  }

  ::v-deep .course_benbenTabsfd1_0 {
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
    background-color: #CC221C;
  }

  .course_flex_2 {
    width: 100%;
    padding: 24rpx;

    // position: fixed;
    // top: 260rpx;
    // left: 0;
    // margin-top: 260rpx;
  }

  .course_fd2_0_c2_c1 {
    font-size: 24rpx;
    line-height: 33rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
  }

  .course_fd2_0_c2_c0 {
    font-size: 28rpx;
    font-weight: 500;
    line-height: 40rpx;
    margin: 0rpx 0rpx 16rpx 0rpx;
    width: 100%;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .course_fd2_0_c2 {
    padding: 16rpx 16rpx 07rpx 16rpx;
  }

  .course_fd2_0_c1 {
    background: linear-gradient(180deg, #FF6648 0%, #FF8C49 100%);
    position: absolute;
    background-size: 100% auto;
    width: 88rpx;
    line-height: 33rpx;
    text-align: center;
    color: var(--benbenFontColor3);
    font-size: 24rpx;
    font-weight: 500;
    border-radius: 16rpx 0rpx 16rpx 0rpx;
  }

  .course_fd2_0_c0 {
    width: 342rpx;
    height: 220rpx;
    border-radius: 16rpx 16rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 0rpx;
    z-index: 1;
  }

  .course_fd2_0 {
    background: #fff;
    width: 342rpx;
    height: 342rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    margin: 0rpx 0rpx 16rpx 0rpx;
    position: relative;
    z-index: 1;
    // background-color: red;
  }
</style>
